#pragma once

#include "UMLCompartment.h"

#include "UMLDiagramElement.h"

namespace uml {

UMLCompartment::UMLCompartment(const QString& umlType)
    : UMLDiagramElement(umlType) {}

void UMLCompartment::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    UMLDiagramElement::fromJson(json, errorList);
    JsonSerializable::fromJsonArray(elementInCompartments_, "elementInCompartments", json, errorList);
}

void UMLCompartment::toJson(QJsonObject& json) {
    UMLDiagramElement::toJson(json);
    JsonSerializable::toJsonArray(elementInCompartments_, "elementInCompartments", json);
}

/// <summary>
/// elementInCompartments getter
/// Contents of the compartment.
/// </summary>
vector<shared_ptr<UMLDiagramElement>>& UMLCompartment::elementInCompartments() {
    return elementInCompartments_;
}

} // namespace uml
